package com.aiatomic.couting;

import com.aiatomic.couting.templates.MyTemplatesFragment;
import com.aiatomic.couting.templates.OnlineTemplatesFragment;

import android.content.Context;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import android.view.ViewGroup;

public class SimpleFragmentPagerAdapter extends FragmentPagerAdapter {

	final int PAGE_COUNT = 2;
	private Context context;
	public Fragment[] frgs=new Fragment[]{new MyTemplatesFragment(),new OnlineTemplatesFragment()};
	public SimpleFragmentPagerAdapter(FragmentManager fm, Context context) {
		super(fm);
		this.context = context;
	}

	@Override
	public Fragment getItem(int position) {
		return frgs[position];
	}

	@Override
	public int getCount() {
		return PAGE_COUNT;
	}

	@Override
	public CharSequence getPageTitle(int position) {
		String title = "";
		switch (position) {
		case 0:
			title = context.getString(R.string.myTemplates);
			break;
		case 1:
			title = context.getString(R.string.allTemplates);
			break;
		}
		return title;
	}

	Fragment currentFragment;

	@Override
	public void setPrimaryItem(ViewGroup container, int position, Object object) {
		currentFragment = (Fragment) object;
		super.setPrimaryItem(container, position, object);
	}
	
	

}
